const { ccclass, property, executeInEditMode } = cc._decorator;
const gfx = cc['gfx'];
import fiveVertAssembler from "./fiveVertAssembler";
@ccclass
@executeInEditMode
export default class fiveVertSprite extends cc.Sprite {

    meshRenderer: cc.MeshRenderer = null;
    _anchorPoint: cc.Vec2 = cc.v2(0, 0);
    get anchorPoint() {
        return this._anchorPoint;
    }
    set anchorPoint(v: cc.Vec2) {
        this._anchorPoint = v;
        this.updateVertexes();
    }


    _assembler: fiveVertAssembler = null;

    updateVertexes() {
        //@ts-ignore
        let assembler = this._assembler;
        if (!assembler) {
            return;
        }

        assembler.anchorPoint = this._anchorPoint;
        // assembler.genVert();
        this.setVertsDirty();
    }

    onEnable() {
        super.onEnable();
    }

    _resetAssembler() {
        this.setVertsDirty();
        let assembler = this._assembler = new fiveVertAssembler();
        this.updateVertexes();

        assembler.init(this);

        //@ts-ignore
        this._updateColor();
    }
}
